<template>
	<div class="homebox">
		<Tabbar :leftArrow='true' :title="$t('textTrans.充值')" :hidden='false'></Tabbar>
		<div class="box">
			<div class="box-back back1" @click="$router.push({name:'rechargeList',query:{type:1}})">
				  <img src="../../assets/imgs/quotation/zr1.png" alt="">
				<div style="padding:10px 0 0px 0">
			   {{$t('textTrans.转入推广账户')}}
				</div>
			</div>
			<div class="box-back back2"  @click="$router.push({name:'rechargeList',query:{type:2}})">
				  <img src="../../assets/imgs/quotation/zr1.png" alt="">
				<div style="padding:10px 0 0px 0">
               {{$t('textTrans.转入基本账户')}}
				</div>
			</div>

		</div>
		<div style="padding:20px;font-size:14px;color:#999999">
              <div>
               {{$t('textTrans.投资分为两种模式')}}
			  </div>
			    <div>
               {{$t('textTrans.投资一')}}
			  </div>
			    <div>
               {{$t('textTrans.投资二')}}
			  </div>
		</div>
	</div>
</template>

<script>
	import {
		configDrawList
	} from "../../api/home";
	import {
		remitCommit,userInfo,configPayList
	} from "../../api/personal";
	import {
		sendSms
	} from "@/api/login";
	import {
		userAccount
	} from "@/api/home";
	export default {
		data() {
			return {
				radio:'1',
				typeCheck:null,
				noticeList: {},
				code: "",
				userInfo: {},
				number: "",
				moneyData:[
					{ name:'300' },
					{ name:'700' },
					{ name:'1500' },
					{ name:'3000' },
					{ name:'6000' },
					{ name:'10000' },
					// { name:'4000' },
					// { name:'5000' },
				],
				disabled: false,
				timer: null,
				timeTips: "发送验证码",
				time: 60,
				draw_id: "",
				money: "",
				address: "",
				cuname: "",
				cardinal_number: "",
				rate: "",
				pay_password: "",
			};
		},
		created() {
		
			userAccount().then((res) => {
				if(this.$route.query.data){
					if(this.$route.query.data>res[1].account){
						this.address=this.$route.query.data-res[1].account
					}else{
						this.address=0
					}
				}
				this.userInfo = res;
				// this.cardinal_number = res[2];
			});
			userInfo().then((res) => {
				this.temp = res;
			});
			// configPayList().then((res) => {
			// 	if (res) {
			// 		this.radio = res[0].id;
			// 		this.noticeList = res;
			// 	} else {
			// 		this.$toast("暂不支持提现");
			// 	}
			// });
		},
		methods: {
			checkmoney(data,index){
				this.typeCheck=index
				this.address=data.name
			},
			countDown(time) {
				if (time === 0) {
					this.disabled = true;
					this.codetext = "获取验证码";
					return;
				} else {
					this.disabled = false;
					this.codetext = "重新发送(" + time + ")";
					time--;
				}
				setTimeout(() => {
					this.countDown(time);
				}, 1000);
			},
			getCode() {
				sendSms(this.temp.phone).then((res) => {
					let time = this.time;
					const timer = setInterval(() => {
						if (time <= 1) {
							this.disabled = false;
							this.timeTips = "发送验证码";
							clearInterval(timer);
						} else {
							this.disabled = true;
							time--;
							this.timeTips = time + "s后重新获取";
						}
					}, 1000);
				});
			},
			getnumber() {
				this.rate = (this.number / 100) * this.noticeList.rate;
				console.log(this.rate);
			},
			goRight() {
				this.$router.push({
					path: "withdrawRecord",
				});
			},
			getrate() {
				this.rate = (this.noticeList[0].rate / 100) * this.money;
			},
			getid(item, index) {
				this.draw_id = item.id;
				this.cardinal_number = this.userInfo[index + 1];
				this.cuname = item.name;
			},
			submit() {
				let data = {
					account: this.address,
					config_pay_id: this.radio,
				};
				remitCommit(data).then((res) => {
					this.radio = "";
					this.address = "";
					console.log(res)
				    window.location.href=res.pay_url
				});
			},
			onClickLeft() {
				this.$router.go(-1);
			},
		},
	};
</script>

<style scoped lang="less">
	/deep/.van-cell-group{
		background: #004e49;
	}
	.check{
		width: 30%;
		padding: 10px 0;
		text-align: center;
		color: #fff;
		background: #326964;
		border-radius: 10px;
		margin-bottom: 10px;
		font-size: 16px;
	}
	.no-check{
		width: 30%;
		padding: 10px 0;
		text-align: center;
		background: #00A170;
		border-radius: 10px;
		margin-bottom: 10px;
		font-size: 16px;
	}
	/deep/.van-icon-card{
		color: #326964;
	}
	.p-type {
		color: #fff;
		font-size: 15px;
		margin: 15px;
		font-weight: 550;
	}

	/deep/.van-cell {
		margin:  10px;
		box-sizing: border-box;
		width: 92%;
		border-radius: 10px;
		background: #F5F5F5;
		color: #333;
	}

	/deep/.van-field__control {
		background: #F5F5F5;
		color: #333;
	}

	.homebox {
		width: 100%;
		height: 100%;
		// background: url('../../assets/imgs/home/beijing.png') no-repeat;
		// background-size: 100% 100%;
	}
.box{
	padding: 20px;
	display: flex;
	justify-content: space-between;
	.box-back{
		width: 45%;
		padding: 40px 0 60px 0;
		background: red;
		border-radius: 8px;
		text-align: center;
		font-size: 15px;
		color: white;
		img{
			width: 40px;
			height: 45px;
		}
	}
	.back1{
		background: linear-gradient(132deg, #918AFE 0%, #54AFFD 100%);
	}
	.back2{
	background: linear-gradient(135deg, #FD8244 0%, #FFB499 100%);
	}
}
</style>
